/**
 * PersonalOrder.java
 * @author taowei20061122@163.com
 * 2013-6-14 下午4:23:10
 */
package study.designpattern.prototype.impl;

import study.designpattern.prototype.OrderApi;

/**
 * 个人订单对象
 * @author taowei20061122@163.com
 * 2013-6-14 下午4:23:10
 */
public class PersonalOrder implements OrderApi {
	private String customerName;
	private String productId;
	private int orderProductNum = 0;
	
	public int getOrderProductNum() {
		return this.orderProductNum;
	}


	public void setOrderProductNum(int num) {
		this.orderProductNum = num;
	}


	/**
	 * @return the customerName
	 */
	public String getCustomerName() {
		return customerName;
	}


	/**
	 * @param customerName the customerName to set
	 */
	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}


	/**
	 * @return the productId
	 */
	public String getProductId() {
		return productId;
	}


	/**
	 * @param productId the productId to set
	 */
	public void setProductId(String productId) {
		this.productId = productId;
	}

	public String toString() {
		return "本个人订单的订购人是"+customerName+", 订购的产品是"+productId+", 订购数量为"+orderProductNum;
	}
	
	/**
	 * 克隆方法
	 * @return 订单原型的实例
	 */
	public OrderApi cloneOrder() {
		// 创建一个新的订单，然后把本实例的数据复制过去
		PersonalOrder order = new PersonalOrder();
		order.setCustomerName(this.customerName);
		order.setOrderProductNum(this.orderProductNum);
		order.setProductId(productId);
		return order;
	}


}
